Chapter 1: A Form Is a Window
- Creating Your First Form
- Adding a Title
- Saving the Form
- Using Components
- Changing Properties
- Responding to Events
- Compiling and Running a Program
- Changing Properties at Run-Time
- Adding Code to the Program
- A Two-Way Tool
- Looking at the Source Code
- The Textual Description of the Form
- The Project File
- Summary
Chapter 2: Highlights of the Delphi Environment
- Different Versions of Delphi
- Asking for Help
- Delphi Menus and Commands
- Using the Menus
- The SpeedBar
- The SpeedMenus
- Working with Forms
- The Components Palette
- The Object Inspector
- The Alignment Palette
- Writing Code
- Managing Projects
- The Project Manager
- Setting Project Options
- Compiling a Project
- Exploring a Compiled Program
- The Integrated Debugger
- The Object Browser
- Additional Delphi Tools
- The Files Produced by the System
- Summary
Chapter 3: The Object Repository and the Experts
- The Object Repository
- The Pages of the Object Repository
- Delphi Experts
- The Database Form Expert
- Customizing the Object Repository
- Adding New Application Templates
- Adding New Form Templates to the List
- The Object Repository Options
- Summary
Chapter 4: The Pascal Language
- Pascal Data Types
- Predefined Data Types
- Specific Windows Types
- Typecasting and Type Conversions
- The Variant Data Type
- User-Defined Data Types
- Pascal Strings
- Long Pascal Strings
- C-Like Character Arrays
- Coding Style
- Comments
- Use of Uppercase
- White Spaces
- Pretty-Printing
- Syntax Highlighting
- Pascal Statements
- Expressions and Operators
- Simple and Compound Statements
- Pascal Conditional Statements
- If Statements
- Case Statements
- Pascal Loops
- For Statements
- While and Repeat Statements
- The With Statement
- Pascal Procedures and Functions
- Reference Parameters
- Constant Parameters
- Open Array Parameters
- What Is a Method?
- Forward Declarations
- External Declarations
- Procedural Types
- Summary
Chapter 5: Object Pascal as an OOP Language
- Introducing Classes and Objects
- The Delphi Object Model
- The First Delphi Example with Classes
- Declaring a Constructor
- Classes and Information Hiding
- Private, Protected, and Public
- Public and Published
- Classes and Units
- The Interface of a Class
- Units and Scope
- Encapsulating Changes
- A Date Unit
- Units and Programs
- Advanced Topics Relating to Methods and Classes
- The Self Keyword
- Class Methods and Class Data
- Method Pointers
- Class References
- Inheriting from Existing Types
- Inheritance and Type Compatibility
- Virtual and Dynamic Methods
- Overriding Virtual and Static Methods
- Virtual versus Dynamic Methods
- Message Handlers
- Abstract Methods
- Run-Time Type Information
- Handling Exceptions
- An Example of the Use of Exceptions
- The Finally Block
- Summary
Chapter 6: The Visual Component Library
- The Conceptual Foundation
- The VCL Hierarchy
- Components
- Objects
- Exceptions
- Using Components and Objects
- Properties
- The Name Property
- Properties Related to Component Size and Position
- The Enabled, Visible, and Showing Properties
- The Tag Property
- Properties Related to Color and Font
- Component Methods
- Component Events
- Delegation Is the Key
- Events Are Properties
- Using Delphi Collections
- The VCL Source Code
- Summary
Chapter 7: A Tour of the Basic Components
- Windows' Own Components
- Clicking a Button
- The BUTTONS Example
- Clicking the Mouse on a Component
- Adding Colored Text to a Form
- The LABEL_CO Example
- The Standard Color Dialog Box
- Dragging from One Component to Another
- The Code for the DRAGGING Example
- Accepting Input from the User
- Handling the Input Focus
- Entering Numbers
- Sophisticated Input Schemes
- Creating a Simple Editor
- The Font Dialog Box
- Creating a Rich Editor
- Selecting a Choice
- Grouping Radio Buttons
- The PHRASES Example
- A List with Many Choices
- The Form for PHRASES2
- Working with the List Boxes
- Removing a Selected String from the Other List
Box
- Allowing Multiple Selections
- The Third Version of PHRASES
- Many Lists, Little Space
- Choosing a Value in a Range
- The Scroll Color Example
- Summary
Chapter 8: Creating and Handling Menus
- The Structure of a Menu
- Different Roles of Menu Items
- Changing Menu Items at Run-Time
- Editing a Menu with the Menu Designer
- The Standard Structure of a Menu
- Menu Shortcuts
- Using the Predefined Menu Templates
- Responding to Menu Commands
- The Code Generated by the Menu Designer
- The Code of the MENU_ONE Example
- Checking and Disabling Menus
- Changing Menu Items
- Changing Pull-Down Menus
- Changing the Menu Structure at Run-Time
- Short and Long Menus
- Customizing the Menu Check Mark
- Changing the System Menu
- The NOTES Program Menu
- Loading and Saving Files
- Pop-Up Menus (and the Right Mouse Button)
- The LOCAL Example
- Changing a Pop-up Menu When It Is Activated
- Handling Pop-Up Menus Manually
- Summary
Chapter 9: Back to the Form
- Forms versus Windows
- Overlapped, Pop-Up, and Child Windows
- The Application Is a Window
- Setting Form Styles
- Creating Topmost Forms
- Avoiding Topmost Flickering
- The Border Style
- The Effect of the BorderStyle Property
- The BORDERS Example
- The Border Icons
- Setting More Windows Styles
- Forms in Different Screen Resolutions
- Manual Form Scaling
- Automatic Form Scaling
- Setting the Form's Position and Size
- The Size of a Form and Its Client Area
- The Maximum and Minimum Size of a Form
- Automatic Form Creation
- Closing a Form
- Getting Mouse Input
- Using Windows without a Mouse
- The Mouse Events
- Drawing on the Form
- The Drawing Tools
- Drawing Shapes
- Drawing and Painting in Windows
- Painting a Single Shape
- Painting a Number of Shapes
- Delphi Output Components
- Summary
Chapter 10: Graphical Components
- Improving the User Interface with Graphics
- A Bitmap in a Button
- A Car in a Button
- An Animated Bitmap in a Button
- A Two-State Button
- Many Images in a Bitmap
- The Rotating World
- A List of Bitmaps, the Use of Resources, and
a PaintBox
- An Image Viewer
- Drawing in a Bitmap
- Drawing Shapes
- Graphical Lists
- The Outline of the Book
- A Tree of Chapters
- The Nodes of the Outline
- A Graphical List
- Building Grids
- A Grid of Fonts
- Mines in a Grid
- Choosing Colors
- Summary
Chapter 11: A Toolbar and a Status Bar
- Grouping Controls with Panels
- Building a Toolbar
- A Simple Toolbar
- Enabling and Disabling Toolbar Buttons
- Adding Hints to the Toolbar
- Adding Hints to a Form
- Customizing Hints
- Adding Features to a Toolbar
- A Combo Box in a Toolbar
- A Toolbar You Can Drag
- Creating a Status Bar
- Menu Hints in the Status Bar
- Speed Button Hints in the Status Bar
- Summary
Chapter 12: Multiple Forms and Dialog Boxes
- Dialog Boxes versus Forms
- Adding a Second Form to a Program
- Modal and Modeless Forms
- Two Forms, Two Menus
- Merging Form Menus
- Creating a Dialog Box
- Modal Dialog Boxes
- A Modeless Dialog Box
- Using Predefined Dialog Boxes
- Windows Common Dialogs
- Message Boxes Parade
- A Dialog Box as a Main Window
- Extensible Dialog Boxes
- Special About Boxes
- Using the System About Box
- Building a Custom Hidden Screen
- Visual Form Inheritance
- Inheriting from a Base Form
- Polymorphic Forms
- Summary
Chapter 13: Scrolling and Multipage Forms
- When Forms Are Too Big
- Scrolling a Form
- The Scroll Testing Example
- Automatic Scrolling
- Scrolling an Image
- Scrolling and Form Coordinates
- Building Notebooks with Delphi
- TabControl, PageControl, and TabSheets
- A Notebook with a Tab Set
- Changing the Page of a Notebook
- Tabbed Notebooks
- Notebooks without Tabs and Tabs without Notebooks
- A Presentation in a Notebook
- An Image Viewer with Tabs
- An Image Browser with Tabs
- A Multipage Toolbar
- Summary
Chapter 14: Splitting Windows
- Form Splitting Techniques
- Splitting with a Header
- Using the HeaderControl component
- Using the Header Component
- Setting a Maximum and Minimum Size
- A Header behind the Scenes
- Splitting with Panels
- Drawing a Split Line
- Direct Mouse Splitting
- Dragging the Mouse
- The Dragging Code
- A Custom File Manager
- Components Used in the File Manager
- Adding a Preview Pane to the File Manager
- Summary
Chapter 15: Creating MDI Applications
- MDI in Windows: A Technical Overview
- Frame and Child Windows in Delphi
- A First Delphi MDI Demo
- Building a Complete Window Menu
- Building a Child Window
- MDI Applications with Different Child Windows
- Adding a Bouncing Shape
- The Menu Bar of the New Child Form
- Changing the Main Form
- A Fast Start with MDI
- Summary
Chapter 16: Using OLE Controls
- What Is an OLE Control?
- OLE Controls versus Delphi Components
- OLE Controls in Delphi
- Installing a New OLE Control
- The TOLEControl Class
- Using OLE Controls
- Building a Chart
- But What about Writing OLE Controls in Delphi?
- Summary
Chapter 17: Building Database Applications
- Data, Files, Databases, and Tables
- What Is a Table?
- Operations on Database Data
- Delphi Database Components
- Tables and Queries
- Other Data-Access Components
- Delphi Data-Aware Components
- Building Database Applications by Hand
- A Grid of Countries
- Customizing the DBGrid
- Navigating through Countries
- Using a Query
- A Query with Parameters
- Using the Database Form Expert
- Accessing the Fields of a Table or Query
- The TField Components
- An Example of a Calculated Field
- Using Fields to Manipulate a Table
- Looking for Records in a Table
- Changing the Data and Computing New Values
- Exploring the Tables of a Database
- Choosing a Database and a Table at Run-Time
- A Table Viewer
- A Field Editor
- An Outline for a Table Browser
- Creating a Graphical Table
- The Form and Its Startup Code
- Creating a New Table
- Choosing a Table with the Proper Fields
- Adding or Removing Records
- A Multi Record Grid
- Moving Control Grid Panels
- Building a Master Detail Form with the Expert
- Making a Join with SQL Queries
- Providing a Closed Selection in a Combo Box
- A Lookup in a Grid
- Summary
Chapter 18: Client/Server and Advanced Database Applications
- Accessing a SQL Server
- A First InterBase Application
- Accessing a SQL Server
- InterBase Server Tools
- Upsizing an Existing Program
- Copying a Table
- Porting the Application
- Using the Visual Query Builder
- From Porting to Upsizing
- Joining Tables with the Visual Query Builder
- A Join with Three Tables
- A Join with More Tables
- From a Two-Tier to a Three-Tier Architecture
- Creating a Data Module
- A Data Module for Multiple Views
- Setting Fields Properties and Initial Values
- Standard Tables Filtering
- Custom Table Filtering
- Custom Filtering and Client/Server Development
- Delphi Data Dictionary
- Summary
Chapter 19: Discovering the Application Structure
- Using the Application Object
- Showing the Application Window
- Checking for Multiple Instances of an Application
- Testing to See if Another Instance Is Running
- Activating the Previous Instance
- Handling User-Defined Windows Messages
- Searching the Windows List
- Programming without Components
- The Smallest Delphi Program?
- Reading the Command Line
- Using the Command Show Parameter
- Events, Messages, and Multitasking in Windows
- Event-Driven Programming
- Windows Message Delivery
- Building a Clock with a Timer
- Behind the Timers: The Clock
- A Full-Scale Graphical Clock
- Painting the Seconds Hand with Raster Operations
- Idle Computing and Multitasking
- Background Processing
- Computing Prime Numbers the Dumb Way
- Multithreading in Delphi
- The TThread Class
- A First Example
- Setting Threads Priorities
- Synchronizing Threads
- A Final Multithreading Example
- Using the Screen Object
- Getting Screen Information
- Handling the Forms List
- Saving Status Information
- Using Windows INI Files
- Using the Registry
- Summary
Chapter 20: Exploring the Behavior of a Program
- Debugging with the Debugger
- Debug Information
- Setting Breakpoints
- Inspecting Values
- More on Breakpoints
- Tracing through the VCL Source Code
- Alternative Debugging Techniques
- Debugging with a Terminal Window
- Debug and Release Versions
- Viewing a Compiled Program with the Object Browser
- Exploring the Message Flow
- Using WinSight
- A Look at Posted Messages
- The Memory Image of an Application
- Windows System Memory
- Free System Memory
- Summary
Chapter 21: Using Resources
- Resources in Windows
- Using Resource Editors
- Loading Resources in Delphi
- The Icons for Applications and Forms
- Adding Alternative Icons for Different Conditions
- Using the Cursor in Delphi
- Designing a Custom Cursor
- A Flexible Cursor
- Using String Table Resources
- Translating the Strings into Another Language
- Summary
Chapter 22: Adding Printing Capabilities to Delphi
Applications
- Printing a Whole Form
- A Custom Print Dialog Box
- The Standard Print Dialog Boxes
- Accessing the Printer Object
- Printing Graphics and Using Print Preview
- Painting to the Printer
- Printing Text
- Printing Database Records and Tables
- The QuickReport Components
- A Quick Example
- Creating ReportSmith Reports
- Building a Custom Report
- Writing a ReportSmith Macro
- Quicker Than ReportSmith
- Summary
Chapter 23: Adding File Support to Applications
- Files and the Pascal Language
- Handling Text Files
- A Text File Converter
- Saving Generic Data
- File Support in Delphi Components
- File System Components
- Streaming Data
- The Idea of Persistency
- Summary
Chapter 24: Exchanging Data
- What Is the Clipboard?
- The Clipboard in Delphi
- Copying and Pasting Text
- Copying and Pasting Bitmaps
- Copying Delphi Components to the Clipboard
- Copying Custom Data to the Clipboard
- Dynamic Data Exchange (DDE): A Technical Overview
- DDE Conversations
- Roles of the Server and Client
- DDE in Delphi
- A Simple Example of DDE
- Copying and Pasting DDE Links
- Copying Link Data to the Clipboard
- DDE with Timers and Graphics
- The Automatic Server
- A Graphical DDE Client
- Summary
Chapter 25: The Power of OLE
- What Is an OLE Object?
- The Flavors of OLE
- OLE Behind the Scenes
- OLE Support in Delphi
- Building the Minimum OLE Container
- The Minimal Menu of an OLE Container
- Visual Editing and Toolbars
- The OLE Standard Dialog Boxes
- Multiple OLE Containers
- Creating OLE Containers at Run-Time
- Dragging Components and Activating OLE Containers
- OLE Automation
- Sending Data to Word
- Writing an OLE Automation Server
- Automating an MDI application
- Registering the Automation Object
- Writing a Test Program
- The future of OLE
- Summary
Chapter 26: Multimedia Fun
- Windows Default Sounds
- Every Box Has a Beep
- From Beeps to Music
- The Media Player Component
- Playing Sound Files
- Running Videos
- A Video in a Form
- Working with a CD Drive
- Summary
Chapter 27: Creating Components
- Extending the VCL
- Delphi Components Are Classes
- Static Linking Components
- Rules for Writing Components
- Introducing Some Simple Components
- The Fonts Combo Box
- Using the Fonts Combo Box
- Creating a Tabbed List Box
- Testing the Tab List Component
- Building Brand-New Components
- A Graphical Component Built Step by Step
- Defining an Enumerated Property
- Drawing the Arrow Component
- Testing the Arrow
- The Point of the Arrow, Plus a Pen and a Brush
- Testing the Second Version of the Arrow
- Defining a New Custom Event
- Testing the OnArrowDblClick Event
- Adding a Bitmap for the Components Palette
- The Final Test of the Arrow Component
- Correcting Bugs in the Arrow Component
- Arrows and Shapes
- The Clock Components
- The Digital Clock
- The Analog Clock
- A First Test
- Installing the Clock Components
- Defining an Array Property
- The New Tabbed List
- Using Dialog Box Units
- Installing the Component
- A Header and a Tabbed List Box
- Writing a Property Editor
- Forms Are Components, Too
- A Dialog Box in a Component
- Using the Nonvisual Component
- Summary
Chapter 28: Dynamic Link Libraries
- The Role of DLLs in Windows
- What Is Dynamic Linking?
- What Are DLLs for?
- The System DLLs
- Differences between DLLs and EXEs
- Rules for DLL Writers
- Win16 and Win32 DLLs
- Using Existing DLLs
- Calling a C++ DLL
- Creating a DLL in Delphi
- Routines, Methods, Objects, and DLLs
- A First Simple Delphi DLL
- Placing a Form in a DLL
- Calling the DLL Form from Delphi
- Calling a Delphi DLL from Other Languages
- A DLL of Icons
- Loading the Icons from the DLL
- Calling a DLL Function at Run-Time
- A DLL in Memory
- Summary
Appendix A: A Short Overview of OOP Concepts
- Abstraction in Programming Languages
- Classes
- Inheritance
- Polymorphism
- A Definition of OOP
- OOP Languages
- Object-Oriented Analysis and Design
- Summary
Appendix B: An Introduction to SQL
- What Is SQL?
- The Select Statement
- The Where Clause
- Avoiding Duplicates
- Making a Join
- More Select Clauses
- Choosing an Order
- Computing Values
- Defining Groups
- Beyond Select
- Summary